<template>
	<view class="mainBg h100 ">
		<z-paging ref="paging" v-model="list" @query="getList" loading-more-default-text="我也是有底线的哦">
			<navbar title="免费专区">
				<navigator url="/pages/index/search">
					<image src="@/static/index/search.png" mode=""></image>
				</navigator>
			</navbar>
			<view class="list container">
				<navigator :url="`./detail?id=${item.id}`" v-for="item,index in list" :key="item.id">
					<view class="col">
						<item :item="item" />
					</view>
				</navigator>
			</view>
		</z-paging>
	</view>
</template>

<script>
	import item from "./item.vue"
	export default {
		components: {
			item
		},
		data() {
			return {
				list: []
			}
		},
		methods: {
			getList(pageNo, pageSize) {
				this.$get("/course/free_course_list", {
					pageNum: pageNo,
					pageSize:pageSize
				}).then(res => {
					//请勿在网络请求回调中给dataList赋值！！只需要调用complete就可以了
					this.$refs.paging.complete(res.data.rows);
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #35CBAD;
	}

	.navBar uni-navigator {
		position: absolute;
		width: 40rpx;
		height: 40rpx;
		right: 40rpx;
		top: 50%;
		transform: translateY(-50%);
	}

	.list .col {
		padding: 40rpx 20rpx;
		margin: 20rpx 0;
		background-color: #fff;
		border-radius: 10rpx;
	}
</style>